package app;

import model.Response;
import service.OkyRobotServiceImpl;
import service.RobotService;

import java.io.IOException;
import java.nio.file.LinkPermission;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("老板，请给我取个名字吧～");
        String name = scanner.nextLine();
        System.out.println("Hi 我是你的机器人助手："+name+"，请给我下达指令吧～");
        while (true){
            String input = scanner.nextLine();
            if ("886".equalsIgnoreCase(input)){
                System.out.println("欢迎下次使用～");
                 break;
            }else {
                RobotService robotService = new OkyRobotServiceImpl();
                Response response = robotService.qa(input);
                if (response != null && response.getCode() == 0){
                    System.out.println(new String(response.getContent().getBytes(),"UTF-8"));
                }else {
                    System.out.println("暂时没明白你的意思，请重新告诉我下吧～");
                }
            }
        }
        scanner.close();
    }
}
